Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
[partially solved]Javascript Regex for allowing all non-english alphabets , hyphen and underscore and block everythinh else?

In Javascript, I need to allow alphabets of all (or preferrably accented characters and chinese) languages, hyphen and underscore. I need to disallow special characters and numerals. I looked at many answers but couldn't find anything that matches my needs.

Allowed patterns:

ab_c
åb-ç
的å

Disallowed patterns

å!_
å123
!_!

Please share with me if you have a snippet.. I am on a deadline and freaking out :(

Edit: The following regex matches all non-English characters. If I can alphabets and hypehn and underscore, it would be complete

/[^\u0000-\u007F]/.test("ji");

I got this snippet from this link: https://stackoverflow.com/a/46413244

I added alphabtes, -, _ like below but it fails. Can anyone help?

/[^a-z\_\-\u0000-\u007F]/.test("ji");
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Well, the regex you gave at the end of the answer incorrectly excludes _ and -. The same thing that allows _ and - is /[^a-z\u0000-\u007F]|[_-]/

Edit: But what you really want is: /[^\u0000-\u007F]|[a-zA-Z-_]/

Or manually exclude all the special characters you want to: /[^(0-9!?@#$%^&*()+\\=[\]{};':"|,.<>/]/

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda